package com.example.campusforumapi.dao;

import com.example.campusforumapi.entity.Department;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DepartmentMapper {

    /*
     * 返回分页数据列表
     * @param
     * @return
     * */
    @Select("select * from department order by department_id")
    List<Department> list();

    /*
     * 删除
     * @paramUser
     * */
    int delDepartment(List<Integer> ids);

    /*
    * 查找相同院系名数量
    * */
    @Select("select count(*) from department where departmentName = #{departmentName}")
    int findsamedepartmentName(String departmentName);

    /*
    * 查找相同用户ID数量
    * */
    @Select("select count(*) from department where department_id = #{departmentId}")
    int findsameDepartmentId(Integer departmentId);

    /*
     * 添加
     * @paramDepartment
     * */
    int insertDepartment(Department department);
    /*
     * 修改
     * @paramDepartment
     * */
    int upDepartment(Department department);
}
